<?php

	session_start();
	require("connect.php");
	$link = connect_APO();
	
	if (!session_is_registered('ID')) :
		header('Location: login.php?');
	endif;
	
	require("header+logoutB.php");
	headerL();
	
	$error=$_GET['error'];
	$ID=$_SESSION['ID'];
	
	$sql = sprintf("SELECT * From `users` WHERE `ID` = '$ID'");
	$result = mysql_query($sql);
	$row = mysql_fetch_array($result);
	$currentPhone = $row['PhoneNumber'];
	
	echo "<html>
<body class='main'>

<FONT class='mainFont'>
  <CENTER>
    <!--<p><img src = 'images/apopic.jpg'></p>-->
    <br>
	<br>
	  <div class='headerTable' style='width:500'>
	  <div id='links'>
	  <div id='backLink'><A href='profile.php'>Back to Profile</A></div></div>
	  <b class='b1f'></b><b class='b2f'></b><b class='b3f'></b><b class='b4f'></b>
	  <div class='contentf'>
		  <div class = 'headerText'>
				Change Your Phone Number:
		  </div>
		  <div class='phoneNumRow'>Your current phone number is <b>$currentPhone</b>.</div>
		  <div class='phoneNumRow'>When inputting your new phone number, please enter it in the 
		  following formats:</div>
		  <div class='phoneNumRow' style='padding-left:50'>1234567890, (123)456-7890, 123-456-7890</div>";
		  if(strcmp($error,"1")==0){
			echo "<div id='midweekTWrong'><b>Sorry, You entered the phone number in the wrong format. Please try again.</b></div>";
		  }
		  echo "<div class='phoneNumRow' style='padding-bottom:0.5'><form action='changePhoneNumberDB.php' method='post'>
			<label for='newPhone'>New Phone Number: </label>
			<input type='text' name='newPhone'/>
			<input type='submit' value='Change' class='loginButton'/>
		  </div>
	  </div>
	  <b class='b4f'></b><b class='b3f'></b><b class='b2f'></b><b class='b1f'></b></div>
  </CENTER>
</FONT>
</body>
</html>
";

	require("footer.php");
	footer();

	mysql_close($link);
?>
